<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport"
		content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<title>fsu-upgrade</title>
	<link rel="stylesheet" href="../module/css/aui.css" />
	<link rel="stylesheet" href="../../../script/ccssoft/css/ccssoft-lite.css" />
	<link rel="stylesheet" href="../css/base.css" />
</head>

<body>
	<header class="aui-bar aui-bar-nav ccssoft-aui-bar-theme" id="header">
		<a class="aui-btn ccssoft-aui-bar-theme aui-pull-left" id="back" onclick="api.closeWin();"> <span
				class="aui-iconfont aui-icon-left"></span>
		</a>
		<div class="aui-title">
			远程升级
		</div>
	</header>
	<div class="wrapper">
		<div class="box-cpn" id="queryStation" style="display: none">
			<h4>
				<div class="title title-red"></div>
				<div class="aui-tab" id="tab">
					<div class="aui-tab-item" id="tbc1">选择升级包</div>
				</div>
			</h4>
			<div class="my-form" id="my-form"></div>
		</div>
		<div id="content"></div>
	</div>
</body>
<script src="../../../script/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="../module/script/api.js"></script>
<script type="text/javascript" src="../../../script/common.js"></script>
<script type="text/javascript" src="../../../script/debug.js"></script>
<script type="text/javascript" src="../js/fsu-common.js"></script>
<script type="text/javascript" src="../module/script/aui-sharebox.js"></script>
<script type="text/javascript" src="../module/script/aui-dialog.js"></script>
<script type="text/javascript">
	const cacheName = 'fsu-upgrade-operate'
	apiready = function () {
		api.showProgress({
			title: '加载中',
			modal: false
		})
	}
	// 初始化页面
	const param = JSON.parse(handleLocalStorage('get', cacheName))
	const dialog = new auiDialog()
	const sharebox = new auiSharebox()

	let data = JSON.parse(param.data)
	let realData
	// 设置初始状态
	let checkBox

	function realInfo() {
		api.showProgress({
			title: '加载中',
			modal: false
		})
		request({
			url: '/app/signal/list',
			type: 'post',
			data: {
				pageNum: 1,
				pageSize: 1,
				fsuId: data.fsuid,
				mid: data.mid,
				before: data.statusName,
				after: data.statusName == '在线' ? '离线' : '在线',
				deviceId: data.deviceId
			},
			success: res => {
				realData = res.data.resultList[0] || {}
				realData.createTime = data.createTime
				realData.operator = data.operator
				realData.status = data.status
				realData.info = data.info
				// 填充数据
				setDatas(resove(realData))
				$('#status').empty()
				$('#status').append(`执行结果: ${data.statusName}`)
				checkBox = data.rstatus === '开启' ? true : false
				toggleCheckBox()
				return api.hideProgress()
			},
			catch: res => api.hideProgress()
		})
	}

	// 点击确定 回调方法
	function shareboxCallback() {
		const pwd = $('#pwd').val()
		const localPwd = $api.getStorage('LOGIN_PASSWORD')
		let html = '<div style="text-align: center;margin-top:10px;height:50px" class="aui-sharebox-btn">'
		if (!pwd || pwd.length === 0) {
			html += '未输入密码！</div>'
		} else if (!localPwd || localPwd.length === 0) {
			html += '未登录</div>'
		} else if (localPwd != pwd) {
			html += '密码错误！</div>'
		} else {
			return upgrade()
		}
		setTimeout(() => {
			openSharebox(html)
		}, 1000)
	}

	function shareboxClose() {}

	// 下发升级包
	function upgrade(){
		
	}
</script>

</html>